#include<bits/stdc++.h>
using namespace std;
int c[200005],n,ans,bj[200005],js[200005],jsq;
bool cmp(int a,int b)
{
    if(a<b)
        return 1;
    return 0;
}
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i = 0;i<n;i++)
    {
        cin>>c[i];
    }
    sort(c,c+n,cmp);
    for(int i = 0;i<n-1;i++)
    {
        if(c[i+1]>c[i])
            bj[i+1] = js[i]+1;
        else if(c[i+1] == c[i])
            js[i+1] = js[i]+1;
        bj[i+1]+=bj[i];
    }
    for(int i = 0;i<n;i++)
    {
        if(bj[i]-jsq>0)
        {
            jsq++;
            ans++;
        }

    }
    cout<<n-ans;
    return 0;
}
